﻿using Abp.Application.Services;
using Abp.Domain.Repositories;
using Abp.Linq.Extensions;
using AbpVueDemo.JichuxinxiDome.YoufeiDataManager.Dto;
using AbpVueDemo.JichuxinxinDemo;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AbpVueDemo.JichuxinxiDome.YoufeiDataManager
{
    public class YoufeiDataService : AsyncCrudAppService<YoufeiData, YoufeiDataInputDto, int, PageYoufeiDataRequestDto, YoufeiDataCreateDto, YoufeiDataUpdateDto>, IYoufeiDataService
    {
        public YoufeiDataService(
    IRepository<YoufeiData, int> repository) : base(repository)
        {

        }
        /// <summary>
        /// 自定义分页条件查询, 需要重写父类的CreateFilteredQuery方法,让其进行自定义条件筛选
        /// </summary>
        /// <param name="input">查询条件</param>
        /// <returns></returns>
        protected override IQueryable<YoufeiData> CreateFilteredQuery(PageYoufeiDataRequestDto input)
        {
            return base.CreateFilteredQuery(input)

                 .WhereIf(!string.IsNullOrEmpty(input.y_chepai), c => c.y_chepai.Contains(input.y_chepai))
                  .WhereIf(!string.IsNullOrEmpty(input.y_jingbanren), c => c.y_jingbanren.Contains(input.y_jingbanren));
        }
    }
}
